2021-02-20 ActionTextを form object で使いたい by TTTaisonさん
https://youtu.be/X2z3ExH6oik
code:rb
class Person
include ActiveModel::Model
attr_accessor :id, :name, :omg
def initialize(attributes={})
super
@omg ||= true
end
end
person = Person.new(id: 1, name: 'bob')
person.omg # => true
code:rb
def first_or_initialize(attributes = nil, &block) # :nodoc:
first || new(attributes, &block)
end